package utils.utils.baseEnum;

/**
 * Created by Administrator on 2017/8/16.
 */
public enum BizCategoryType {
    category_hotel(1L,"酒店"),
    category_sightseeing(9L,"岸上观光"),
    category_comb_cruise(8L,"邮轮组合产品"),
    category_visa(4L,"签证"),
    category_insurance(3L,"保险"),
    category_cruise(2L,"邮轮"),
    category_addition(7L,"附加项目"),
    category_cruise_addition(10L,"邮轮附加项"),

    //线路产品
    category_route(14L,"线路"),
    category_route_group(15L,"跟团游"),
    category_route_freedom(18L,"自由行"),
    category_route_scene_hotel(181L,"酒+景"),
    category_route_flight_hotel(182L,"机+酒"),
    category_route_traffic_service(183L,"交通+服务"),
    category_route_local(16L,"当地游"),
    category_route_hotelcomb(17L,"酒店套餐"),
    category_route_new_hotelcomb(32L,"酒套餐"),
    category_route_aero_hotel(29L,"交通+X"),

    //交通接驳
    category_connects(41L,"交通接驳"),
    //门票产品
    category_ticket(5L,"门票"),
    category_single_ticket(11L,"景点门票"),
    category_other_ticket(12L,"其它票"),
    category_comb_ticket(13L,"组合套餐票"),


    category_other(90L,"其他"),

    //大交通
    category_traffic(19L,"大交通"),
    category_traffic_aeroplane(20L,"机票"),
    category_traffic_aero_other(21L,"其它机票"),
    category_traffic_train(22L,"火车票"),
    category_traffic_train_other(23L,"其它火车票"),
    category_traffic_bus(24L,"巴士"),
    category_traffic_bus_other(25L,"其它巴士"),
    category_traffic_ship(26L,"船票"),
    category_traffic_ship_other(27L,"其它船票"),
    category_wifi(28L,"WIFI/电话卡"),

    category_local_play(30L, "当地玩乐"),
    category_show_ticket(31L, "演出票"),

    category_presale(99L,"预售劵"),

    category_route_customized(42L,"定制游"),
    //当地玩乐 美食
    category_food(43L,"美食"),
    //当地玩乐 娱乐
    category_sport(44L,"娱乐"),
    //当地玩乐 购物
    category_shop(45L,"购物");

    private Long categoryId;
    private String cnName;

    BizCategoryType(Long categoryId,String name){
        this.categoryId = categoryId;
        this.cnName=name;
    }

    public String getCode(){
        return this.name();
    }
    public Long getCategoryId() {
        return this.categoryId;
    }
    public String getCnName(){
        return this.cnName;
    }

    /**
     * 返回Code
     * @param categoryId
     * @return
     */
    public static BizCategoryType getBizCategoryType(Long categoryId){
        for(BizCategoryType item:BizCategoryType.values()){
            if(item.getCategoryId().equals(categoryId))
            {
                return item;
            }
        }
        return null;
    }

    /**
     * 返回Code
     * @param categoryId
     * @return
     */
    public static String getCode(Long categoryId){
        for(BizCategoryType item:BizCategoryType.values()){
            if(item.getCategoryId().equals(categoryId))
            {
                return item.name();
            }
        }
        return categoryId+"";
    }
    /**
     * 返回名称
     * @param categoryId
     * @return
     */
    public static String getCnName(Long categoryId){
        for(BizCategoryType item:BizCategoryType.values()){
            if(item.getCategoryId().equals(categoryId))
            {
                return item.getCnName();
            }
        }
        return categoryId+"";
    }
    /**
     * 返回名称
     * @param code
     * @return
     */
    public static String getCnName(String code){
        for(BizCategoryType item:BizCategoryType.values()){
            if(item.getCode().equals(code))
            {
                return item.getCnName();
            }
        }
        return code;
    }

    @Override
    public String toString(){
        return this.name();
    }

    /**
     * 是否自由行品类(含 交通+X 品类)
     * @param pCategory
     * @return
     */
    public static boolean isCategoryTrafficRouteFreedom(String pCategory){
        if(pCategory==null || pCategory.trim().length()<=0)	return false;
        return ( BizCategoryType.category_route_freedom.name().equalsIgnoreCase(pCategory)
                ||  BizCategoryType.category_route_aero_hotel.name().equalsIgnoreCase(pCategory)
        );
    }

    /**
     * 是否自由行品类(含 交通+X 品类)
     * @param pCategory
     * @return
     */
    public static boolean isCategoryTrafficRouteFreedom(Long pCategory){
        if(pCategory==null)	return false;
        return ( BizCategoryType.category_route_freedom.getCategoryId().equals(pCategory)
                ||  BizCategoryType.category_route_aero_hotel.getCategoryId().equals(pCategory)
        );
    }
}